import request from '@/utils/request'
var transformRequest = [function (obj) { let c = ''; for (const i in obj) { c += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]) + '&' } return c }]

export function loginCheck(data) {
  return request({
    url: '/loginCheck',
    method: 'post',
    transformRequest,
    data
  })
}

export function getIndexInfo(data) {
  return request({
    url: '/getIndexInfo',
    method: 'post',
    transformRequest,
    data
  })
}

export function getUserList() {
  return request({
    url: '/sys/user/cmemlist',
    method: 'post'
  })
}

export function getUsers() {
  return request({
    url: '/sys/user/getSelectList',
    method: 'post'
  })
}

export function saveUser(data) {
  return request({
    url: '/sys/user/save',
    method: 'post',
    data
  })
}

export function delUser(data) {
  return request({
    url: '/sys/user/deleteById',
    method: 'post',
    data
  })
}

export function getFuncData(data) {
  return request({
    url: '/sys/roleMenu/getMenuListByUserIdAppsId',
    method: 'post',
    data
  })
}

export function getRoleMenus(data) {
  return request({
    url: '/sys/roleMenu/getMenuSVOByUserIdAppsId',
    method: 'post',
    data
  })
}

export function getFuncModules(data) {
  return request({
    url: '/sys/roleRoot/getRootListByUserIdAppsId',
    method: 'post',
    data
  })
}

export function getMessage(data) {
  return request({
    url: '/sys/message/messageList',
    method: 'post',
    data
  })
}

export function getFuncByRoleId(data) {
  return request({
    url: '/sys/roleFunc/getFuncByRoleId',
    method: 'post',
    data
  })
}

export function getRole(data) {
  return request({
    url: '/sys/role/list',
    method: 'post',
    data
  })
}

export function saveRole(data) {
  return request({
    url: '/sys/role/save',
    method: 'post',
    data
  })
}

export function delRole(data) {
  return request({
    url: '/sys/role/deleteById',
    method: 'post',
    data
  })
}

export function toLogout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

export function updatePSW(data) {
  return request({
    url: '/sys/user/updatePSW',
    method: 'post',
    data
  })
}
// 企业信息
export function getmanagementInfo(data) {
  return request({
    url: '/sys/org/datatables',
    method: 'post',
    data
  })
}

// 编辑企业信息
export function updateInfo(data) {
  return request({
    url: '/sys/org/updateInfo',
    method: 'post',
    data
  })
}

// 操作员信息
export function getMapById(data) {
  return request({
    url: '/sys/user/getMapById',
    method: 'post',
    data
  })
}

// 行业列表
export function registerLoadIndustry(data) {
  return request({
    url: '/registerLoadIndustry',
    method: 'post',
    data
  })
}

// 地区列表
export function registerLoadArea(data) {
  return request({
    url: '/registerLoadArea',
    method: 'post',
    data
  })
}

// 纳税人类型
export function registerLoadTaxfilingcategory(data) {
  return request({
    url: '/registerLoadTaxfilingcategory',
    method: 'post',
    data
  })
}

// 注销企业
export function closeAccount(data) {
  return request({
    url: '/sys/org/closeAccount',
    method: 'post',
    data
  })
}

// 修改纳税类型
export function updateTaxFilingCategory(data) {
  return request({
    url: '/sys/org/updateTaxFilingCategory',
    method: 'post',
    data
  })
}

// 下线用户
export function killUser(data) {
  return request({
    url: '/killUser',
    method: 'post',
    data
  })
}

export function killToken(data) {
  return request({
    url: '/killToken',
    method: 'post',
    data
  })
}

// 下线所有用户
export function killAllUser() {
  return request({
    url: '/killAllUser',
    method: 'post'
  })
}

// 清除账套
export function resetBook(data) {
  return request({
    url: '/gl/book/resetBook',
    method: 'post',
    data
  })
}

// 重置账套
export function resetAccount(data) {
  return request({
    url: '/gl/book/deleteById',
    method: 'post',
    data
  })
}

// 重置账套
export function updateLoginAppType(loginAppType, id) {
  return request({
    url: '/sys/user/updateLoginAppType',
    method: 'post',
    data: { loginAppType, id }
  })
}

// 查询账套
export function getAccount(data) {
  return request({
    url: '/gl/book/getAll',
    method: 'post',
    data
  })
}

// 修改账套
export function saveBook(data) {
  return request({
    url: '/gl/book/save',
    method: 'post',
    data
  })
}

// 新建账套
export function addBook(data) {
  return request({
    url: '/gl/book/bookAuxSave',
    method: 'post',
    data
  })
}

export function checkBookNum() {
  return request({
    url: 'gl/book/checkBookNum',
    method: 'post'
  })
}

export function getCurrencyList(data) {
  return request({
    url: '/dim/currency/getSelectList',
    method: 'post',
    data
  })
}

export function getCoaHierarchy(data) {
  return request({
    url: '/std/coaHierarchy/getAll',
    method: 'post',
    data
  })
}

export function reBalance(data) {
  return request({
    url: '/gl/rebalance/reBalance',
    method: 'post',
    data
  })
}

// 会计期间
export function getPeriodList(data) {
  return request({
    url: '/gl/period/getSelectList',
    method: 'post',
    data
  })
}

// 同步数据
export function synbasedata(data) {
  return request({
    url: '/gl/syndata/synbasedata',
    method: 'post',
    data
  })
}
// 期初余额
export function getBalance(data) {
  return request({
    url: '/gl/balance/getListForSetBegin',
    method: 'post',
    data
  })
}

export function importBalance(data) {
  return request({
    url: '/gl/balance/importData',
    method: 'post',
    data
  })
}

// 保存期初余额
export function updateListForSetBegin(data) {
  return request({
    url: '/gl/balance/updateListForSetBegin',
    method: 'post',
    data
  })
}

// 科目分类
export function coaClassification(data) {
  return request({
    url: '/std/coaClassification/select',
    method: 'post',
    data
  })
}

// 科目列表
export function getCoaDatatables(data) {
  return request({
    url: '/gl/coa/datatables',
    method: 'post',
    data
  })
}

export function getGlCoaCode(data) {
  return request({
    url: '/gl/coa/getGlCoaCode',
    method: 'post',
    data
  })
}

export function updateDisabledCoa(data) {
  return request({
    url: '/gl/coa/updateIsDisableById/',
    method: 'post',
    data
  })
}

export function getMsgBeforeDelete(id) {
  return request({
    url: '/gl/coa/getMsgBeforeDelete',
    method: 'post',
    data: { id: id }
  })
}

export function delCoa(id) {
  return request({
    url: '/gl/coa/deleteById',
    method: 'post',
    data: { id: id }
  })
}

export function getCoaCodeUsedByIdNoSysTemplet(id) {
  return request({
    url: '/gl/coa/getCoaCodeUsedByIdNoSysTemplet',
    method: 'post',
    data: { id: id }
  })
}

export function getChildrenCountByParentId(parentId) {
  return request({
    url: '/gl/coa/getChildrenCountByParentId',
    method: 'post',
    data: { parentId: parentId }
  })
}

export function getCoaCodeUsedById(id) {
  return request({
    url: '/gl/coa/getCoaCodeUsedById',
    method: 'post',
    data: { id: id }
  })
}

export function saveCoa(data) {
  return request({
    url: '/gl/coa/save',
    method: 'post',
    data
  })
}

export function getDefaultCoa() {
  return request({
    url: '/gl/book/getDefaultCoa',
    method: 'post'
  })
}

export function updateDispName(bookId) {
  return request({
    url: '/gl/coa/updateDispName/',
    method: 'post',
    data: { bookId }
  })
}

export function getOpeningBalanceStatus() {
  return request({
    url: '/gl/period/getOpeningBalanceStatus',
    method: 'post'
  })
}

// ---------------------------------权限管理---------------------------------
export function getFuncs(data) {
  return request({
    url: '/sys/menu/datatables',
    method: 'post',
    data
  })
}

// ---------------------------------权限管理---------------------------------

export function getFuncsTree(data) {
  return request({
    url: '/sys/menu/treeData',
    method: 'post',
    data
  })
}

export function saveFuncsTree(data) {
  return request({
    url: '/sys/menu/save',
    method: 'post',
    data
  })
}

export function getFuncButtonListByRoleId(data) {
  return request({
    url: '/sys/roleMenu/getMenuListByRoleId',
    method: 'post',
    data
  })
}

export function updateRoleIdByMenuIdList(data) {
  return request({
    url: '/sys/roleMenu/updateRoleIdByMenuIdList',
    method: 'post',
    data
  })
}

// ---------------------------------客户导入---------------------------------

export function importCust(data) {
  return request({
    url: '/importData/cust',
    method: 'post',
    data
  })
}

// ---------------------------------商品导入---------------------------------

export function importItem(data) {
  return request({
    url: '/importData/item',
    method: 'post',
    data
  })
}

// ---------------------------------期初导入---------------------------------

export function importBeginBalance(data) {
  return request({
    url: '/importData/beginBalance',
    method: 'post',
    data
  })
}

// ---------------------------------库存导入---------------------------------

export function getCloseAccountStatus() {
  return request({
    url: '/sys/org/getCloseAccountStatus',
    method: 'post'
  })
}

export function getCleanBookStatus() {
  return request({
    url: '/gl/book/getCleanBookStatus',
    method: 'post'
  })
}

export function getHomeMenu() {
  return request({
    url: '/sys/userMenu/getMenuJsonByUserId',
    method: 'post'
  })
}

export function updateUserIdByMenuIdList(data) {
  return request({
    url: '/sys/userMenu/updateUserIdByMenuJson',
    method: 'post',
    data
  })
}

export function importData(type, data) {
  return request({
    url: '/bd/' + type + '/importData',
    method: 'post',
    data
  })
}

export function getImportCount(data) {
  return request({
    url: '/init/importData/getCount',
    method: 'post',
    data
  })
}

// 期初库存
export function getStore(data) {
  return request({
    url: '/ia/balance/getListForSetBegin',
    method: 'post',
    data
  })
}

export function importStore(data) {
  return request({
    url: '/ia/balance/importData',
    method: 'post',
    data
  })
}

// 保存期初库存
export function updateStore(data) {
  return request({
    url: '/ia/balance/updateListForSetBegin',
    method: 'post',
    data
  })
}
